/*
 * @Author: your name
 * @Date: 2022-04-10 19:36:14
 * @LastEditTime: 2022-04-13 19:25:54
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \drivingTow\src\vehicle\entities\vehicle.entity.ts
 */
import { Column, Entity, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
import { VehicleInfoDto } from "../dto/create-vehicle.dto";

@Entity('Vehicle')
export class Vehicle {
  @PrimaryGeneratedColumn()
  id:number;

  @Column() // 车牌号
  licensePlate:string

  @Column() // 购买日期
  purchase_date:string

  @Column() // 品牌
  brand:string

  @Column() // 型号
  model:string

  @Column() // 购车价格
  price:number

  @Column() // 续保时间
  Renewal_time:string

  @Column() // 保险到期时间
  maturity_time:string

  @Column('simple-enum',{enum:['Using','scrapped'],default:'Using'}) // 车况状态
  vehicle_status:string

  @Column() // 报废日期
  scrap_date:string

  toResponseObject(): VehicleInfoDto {
    let responseObj: VehicleInfoDto = {
      ...this,
    };
    return responseObj;
  }
}
